cttp: streaming HTTP client responses via x-urbit-stream header#976
Draft
niblyx-malnus wants to merge 2 commits intourbit:developfrom
Draft
cttp: streaming HTTP client responses via x-urbit-stream header#976niblyx-malnus wants to merge 2 commits intourbit:developfrom
niblyx-malnus wants to merge 2 commits intourbit:developfrom
Conversation
33cc7d5 to
a2e40f5
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds opt-in streaming mode to iris (cttp) HTTP client. When a request includes
an
x-urbit-streamheader, the runtime sends response data incrementally as%start/%continue/%cancelevents instead of buffering the entire bodyinto a single
%finishedevent.Motivation
The buffered response model requires the entire HTTP response to complete before
Arvo sees any data. This doesn't work for Server-Sent Events (SSE) streams,
which can stay open indefinitely.
How it works
x-urbit-stream: trueheader to the%requestcard%start— headers arrived (with status code and response headers)%continue— body chunk arrived (with optional data and fin flag)%cancel— connection error (replaces the fake 504 in buffered mode)